<?php
    $str_tbl = '';
    $toltal_salary = 0;
    $toltal_time = 0;
    foreach($timesheet as $k=>$v):
        $str_tbl .= '<tr>';
        
        $total = $v['key']*$salary;
        $total = round($total, 2);
        
        $str_tbl .= "<td>".$v['name']."</td>";
        $str_tbl .= "<td>".date('Y/m/d',$v['datestart'])."</td>";
        $str_tbl .= "<td>".date('Y/m/d',$v['dateend'])."</td>";
        //$str_tbl .= "<td>".$v['key']."</td>";
        $str_tbl .= "<td>".$v['detail']."</td>";
        $str_tbl .= "<td>".$total."$</td>";
        
        $toltal_time += ($v['key']);
        $toltal_salary += $total;
        
        $str_tbl .= '</tr>';
    endforeach;
    
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sale Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css" media="print">
.hide{display:none}
</style>
<script type="text/javascript">
function printpage() {
document.getElementById('printButton').style.visibility="hidden";
window.print();
document.getElementById('printButton').style.visibility="visible";  
}
</script>
<body>
<input name="print" type="button" value="Print" id="printButton" onClick="printpage()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center">
          <div align="right">
                      
              </div>
      <table width="595" border="0" cellspacing="0" cellpadding="0">
       
        <tr>
          <td height="30" align="center"><strong>PAYLIST</strong></td>
        </tr>
        <tr>
          <td height="30" align="center">&nbsp;</td>
        </tr>
        <tr>
          <td align="right"><table width="300" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="150"><strong>Staff code: <?=$staffcode?> </strong></td>
              <td width="150">&nbsp;</td>
            </tr>
            <tr>
              <td width="350"><strong>Staff name: <?=$staff?> </strong></td>
              <td width="150">&nbsp;</td>
            </tr>
            <tr>
              <td width="150"><strong>Total salary: <?=$toltal_salary?> </strong></td>
              <td width="150">&nbsp;</td>
            </tr>
            <tr>
              <td width="150"><strong>Total Time: <?=$toltal_time?></strong></td>
              <td width="150">&nbsp;</td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td width="45"><hr></td>
        </tr>
        <tr>
          <td height="20"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="195"><strong>From: <?=$datestart?> </strong></td>
                <td width="143">&nbsp;</td>
                <td width="141"><strong>To: <?=$dateend?> </strong></td>
                <td width="16">&nbsp;</td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td width="45"><hr></td>
        </tr>
        <tr>
          <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><strong>Title</strong></td>
                <td><strong>Date start </strong></td>
                <td><strong>Date end</strong></td>
                <!--<td><strong>Duration(h)</strong></td>-->
                <td><strong>Note</strong></td>
                <td><strong>Total</strong></td>
              </tr>
			  <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <?=$str_tbl?>
			  
          </table></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>

</body>
</html>
